<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Manager</title>
</h:head>
<body>
	<ui:composition template="/pages/common/commonLayout.xhtml">
		<ui:define name="content">
			<h:form>
				<p:panel header="Dane" toggleable="true" closable="false" toggleSpeed="500" 
					closeSpeed="500" widgetVar="panel" style="margin-bottom:20px">
					<table>
						<tr>
							<td><h:outputLabel for="firstName" value="Imie" /></td>
							<td><h:outputText id="firstName"
									value="#{managerMB.chosen.firstName}" /></td>
							<td><h:outputLabel for="lastName" value="Nazwisko:" /></td>
							<td><h:outputText id="lastName" value="#{managerMB.chosen.lastName}" /></td>
						</tr>
						<tr>
							<td><h:outputLabel for="gender" value="Plec:" /></td>
							<td><h:outputText id="gender" value="#{managerMB.chosen.gender.label}" /></td>
							<td><h:outputLabel for="spec" value="Specjalnosc:" /></td>
							<td><h:outputText id="spec" value="#{managerMB.chosen.spec.label}" /></td>
						</tr>
						<tr>
							<td><h:outputLabel for="pesel" value="Pesel:" /></td>
							<td><h:outputText id="pesel" value="#{managerMB.chosen.pesel}" /></td>
						</tr>
					</table>
				</p:panel>
				
				<p:panel header="Dodaj grafik" toggleable="true" closable="false" toggleSpeed="500" 
					closeSpeed="500" widgetVar="panel" style="margin-bottom:20px">
  				    <p:panelGrid columns="7" style="border-width: 0px;">
	  				    	<c:forEach items="#{managerMB.chosen.workingDays}" var="workingDay">
	  							<h:outputText value="#{workingDay.dayOfTheWeek.label}"/>
							        <h:outputText id="displayRange#{workingDay.dayOfTheWeek.label}" 
							        	value="Praca od #{workingDay.startHour} do #{workingDay.endHour}" />
							        <p:slider minValue="7" maxValue="21" disabled="#{!workingDay.working}"
							        	for="txt6#{workingDay.dayOfTheWeek.label},txt7#{workingDay.dayOfTheWeek.label}" 
							        	display="displayRange#{workingDay.dayOfTheWeek.label}" style="width: 150px" 
							        	range="true" displayTemplate="Praca od {min} do {max}" />
								    <p:outputLabel value="Dzien pracujacy"/>
								    <p:selectBooleanCheckbox value="#{workingDay.working}" >
								    	<f:ajax execute="@form" render="@all"/>
								    </p:selectBooleanCheckbox>
								    <h:inputHidden id="txt6#{workingDay.dayOfTheWeek.label}" value="#{workingDay.startHour}" />
								    <h:inputHidden id="txt7#{workingDay.dayOfTheWeek.label}" value="#{workingDay.endHour}" />
	  				    	</c:forEach>
  				    </p:panelGrid>
	  				<p:commandButton action="#{managerMB.saveWorkingHours}" value="Zapisz"/>
	  				<p:commandButton action="#{managerMB.clearWorkingDays}" value="Czysc" update="@all"/>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>
